package com.optimatch.ui.view;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JLayeredPane;

import com.optimatch.ui.view.customComponents.bars.MenuPrincipal;
import com.optimatch.ui.view.customComponents.bars.StatusBar;
import com.optimatch.ui.view.customComponents.bars.ToolBar;
import com.optimatch.ui.view.customComponents.pages.ImportProjetPanel;
import com.optimatch.ui.view.customComponents.pages.NavigationPanel;

public class View extends JFrame {

	private static final long serialVersionUID = 1L;
	
	private JLayeredPane panel;
	private ImportProjetPanel pan_import;
	private NavigationPanel pan_tabs;
	
	private MenuPrincipal menuBar;
	private ToolBar toolBar;
	private StatusBar statusBar;
	
	
	// Constructor

	public View() {
		super();
		initComponents();
		initMenuBar();
		initFrame();
	}
	
	// Initializers

	private void initComponents() {
		this.panel = new JLayeredPane();
		this.pan_tabs = new NavigationPanel();
		this.pan_import = new ImportProjetPanel();
		
		this.menuBar = new MenuPrincipal();
		this.toolBar = new ToolBar();
		this.statusBar = new StatusBar();
		
		// TODO Link to actions & move to putValues
		
//		toolBut_newTask.setIcon(new ImageIcon("pics/toolBar/newTask.png"));
		
//		toolBut_newTask.setToolTipText(LanguageManager.getBundle().getString(Constants.NEW_TASK_TOOL_TIP_TEXT));
	}

	private void initMenuBar() {
		this.setJMenuBar(menuBar);
	}
	
	private void initFrame() {
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//this.setTitle(LanguageManager.getBundle().getString(Constants.APPLICATION_NAME));
		this.setPreferredSize(new Dimension(1260,612));
		
		this.panel.setLayout(new BorderLayout());
		this.panel.add(this.pan_tabs,BorderLayout.CENTER);
		
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(this.toolBar,BorderLayout.PAGE_START);
		getContentPane().add(this.panel,BorderLayout.CENTER);
		getContentPane().add(this.statusBar,BorderLayout.PAGE_END);
		
		this.pack();
		this.setLocationRelativeTo(null);
	}
	
	// Native Getters
	
	public JLayeredPane getPanel() {
		return panel;
	}

	public NavigationPanel getTabs() {
		return pan_tabs;
	}
	
	public MenuPrincipal getMenu() {
		return menuBar;
	}

	public ToolBar getToolBar() {
		return toolBar;
	}

	public StatusBar getStatusBar() {
		return statusBar;
	}
	
	// Display

	public void display() {
		this.setVisible(true);
	}

}
